package com.kuwou.workobject.controller;

import com.kuwou.workobject.pojo.entity.Music;
import com.kuwou.workobject.pojo.entity.RankList;
import com.kuwou.workobject.pojo.vo.MusicVo;
import com.kuwou.workobject.pojo.vo.RankListVo;
import com.kuwou.workobject.service.MusicService;
import com.kuwou.workobject.service.RankListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;

//@RestController
@Controller
@RequestMapping("/rankList")
public class RankListController {

    @Autowired
    private RankListService rankListService;


    @GetMapping("/getRankListTop10")
    @ResponseBody
    public List<RankListVo> getRankListTop10() throws IOException {
        return rankListService.getRankListTop10();
    }

    @GetMapping("/getMusicByRankListId/{id}")
    @ResponseBody
    public List<MusicVo> getRankListById(@PathVariable Integer id) throws IOException {
        return rankListService.getMusicByRankListId(id);
    }

    @GetMapping("/getRankList")
    @ResponseBody
    public List<RankListVo> getRankList() throws IOException {
        return rankListService.getRankList();
    }

    @GetMapping("/getData")
    @ResponseBody
    public List<RankList> getRankData() throws IOException {
        return rankListService.getRankData();
    }

    @GetMapping("/getHotMusic")
    @ResponseBody
    public List<MusicVo> getRankHotMusic() throws IOException {
        return rankListService.getRankHotMusic();
    }



}
